package com.gree.design_patterns.chain.filter;


import com.gree.design_patterns.chain.HandlerChain;
import com.gree.design_patterns.chain.paramter.Responses;
import com.gree.design_patterns.chain.paramter.Requests;

/**
 * @Auther: lyg
 * @Data: 2022/9/1
 */
public class TwoFilter implements Filters {

    @Override
    public void exec(Requests requests, Responses responses, HandlerChain chain) {
        // 前置执行
        if(requests.getMsgData().contains("two")) {
            System.out.println("===执行器Two:处理完毕===");
        }
        // 递归, 向后走, 走到底往回走
        chain.doFilter(requests, responses);
        // 后置执行
        responses.setMsgData(responses.getMsgData() + "---执行器two后置执行完毕---");
    }
}
